package com.piece.blog.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Data
@Entity
@NoArgsConstructor
@Table(name = "blog_article_tag")
@ApiModel(value = "标签表")
public class ArticleTag implements Serializable {

    @Id
    @Column(name = "tag_id", length = 11)
    @ApiModelProperty(value = "标签主键")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer tagId;

    @Column(name = "name")
    @ApiModelProperty(value = "标签名称")
    private String name;

    @Column(name = "thumbnail")
    @ApiModelProperty(value = "预览图")
    private String thumbnail;

    @Column(name = "description")
    @ApiModelProperty(value = "描述")
    private String description;

    @Column(name = "posts")
    @ApiModelProperty(value = "文章数")
    private Integer posts;

    @Column(name = "create_by")
    @ApiModelProperty(value = "作者", notes = "用户表主键")
    private Long createBy;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;
}
